package leetcode.utils;

import leetcode.entity.TreeNode;

public class TreeNodeUtils {

    public static TreeNode createTreeNode(int n){
        TreeNode main = new TreeNode(1);
        TreeNode cur = main;
        for (int i = 2;i<=n;i++){
            TreeNode left = new TreeNode(i);
            cur.left = left;
            cur = cur.left;
        }
        cur = main;
        for (int i = 2;i<=n;i++){
            TreeNode right = new TreeNode(i);
            cur.right = right;
            cur = cur.right;
        }

        return main;
    }
}
